(function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
    	recalc = function () {
        var clientWidth = docEl.clientWidth;
        if (!clientWidth) return;
        if(clientWidth >1024){ clientWidth=980;}
        if(clientWidth<300){ clientWidth=300}
        var sheji=640;
        if(clientWidth >640 )
            sheji=980;
        else if(clientWidth >980)
            sheji=1024;
        docEl.style.fontSize = 32 * (clientWidth / sheji) + 'px'; 
    };
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);